package com.company;

import com.company.utils.*;

import java.io.IOException;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("--------------欢迎使用'裹裹快投'快递服务软件--------------");
        while (true){
            System.out.println("1.我要寄件 2.查询订单 3.修改订单 4.取消订单 5.查询常用联系人 6.退出系统");
            int choice = input.nextInt();
            switch (choice){
                case 1:
                    MailUtil mailUtil = new MailUtil();
                    mailUtil.inputInfo();
                    break;
                case 2:
                    QueryOrderInfo queryOrderInfo = new QueryOrderInfo();
                    queryOrderInfo.queryOrederInfo();
                    break;
                case 3:
                    ModifyOrderInfo modifyOrderInfo = new ModifyOrderInfo();
                    System.out.println("---------修改订单--------");
                    System.out.print("请输入您要修改的订单编号: ");
                    String trackingNumber = input.next();
                    System.out.print("请输入新的收件人信息: ");
                    String recipinetInfo = input.next();
                    modifyOrderInfo.modify(trackingNumber,recipinetInfo);
                    break;
                case 4:
                    CancellationInfo cancellationInfo = new CancellationInfo();
                    System.out.println("---------取消订单--------");
                    System.out.print("请输入您要取消的订单编号: ");
                    String trackingNum = input.next();
                    cancellationInfo.cancellationInfo(trackingNum);
                    break;
                case 5:
                    System.out.println("姓名\t\t电话\t\t\t\t地址");
                    try {
                        /*write();
                        System.out.println("序列化成功");*/
                        FrequentContacts.read();
                        //System.out.println("反序列化成功");
                    } catch (IOException e) {
                        e.printStackTrace();
                    } catch (ClassNotFoundException e) {
                        e.printStackTrace();
                    }
                    break;
                case 6:
                    System.out.println("欢迎下次再来!");
                    System.exit(1);
                default:
                    System.out.println("输入错误,请重新输入!");
                    break;
            }
            System.out.println();
        }
    }
}
